﻿
@{
    ViewBag.Title = "UpdatePwd";
}

@section CSS{
    <link href="~/Content/css/layerui/layui.css" rel="stylesheet" />
}
<div class="content-wrapper">
    <section class="content-header">
        <h1>
            修改
            <small>登录密码</small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> 首页</a></li>
            <li><a href="#">管理员管理</a></li>
            <li class="active">修改登录密码</li>
        </ol>
    </section>
    <section class="content">
        <div class="row">
            <div class="col-md-9">
                <div class="ibox-content">
                    <form class="form-horizontal" id="form-add">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">原密码：</label>
                            <div class="col-sm-6">
                                <input type="password" name="oldPassword" id="oldPassword" class="form-control" placeholder="请输入原密码" required="" aria-required="true" />
                                <span class="help-block m-b-none"></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">新密码：</label>
                            <div class="col-sm-6">
                                <input type="password" name="newPassword" id="newPassword" class="form-control" placeholder="请输入新密码" required="" aria-required="true" />
                                <span class="help-block m-b-none"></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-3 control-label">确认新密码：</label>
                            <div class="col-sm-6">
                                <input type="password" name="confirmPassword" id="confirmPassword" class="form-control" placeholder="请输入确认新密码" required="" aria-required="true" />
                                <span class="help-block m-b-none"></span>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-3">
                                <button class="btn btn-primary" type="submit">修 改</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </section>
</div>
@section JS{
    <script src="~/Content/js/jquery.form.js"></script>
    <script src="~/Content/plugins/validate/jquery.validate.min.js"></script>
    <script src="~/Content/plugins/validate/messages_zh.min.js"></script>
    <script type="text/javascript">

        $("#form-add").validate({
            ajaxPost: true,
            submitHandler: function (form) {
                infosubmit();
            }
        });

        var flag = true;
        function infosubmit() {
            if (flag) {
                $("#form-add").ajaxSubmit({
                    url: "/setting/MotifyUserPwd", type: "POST",
                    dataType: "json",
                    success: function (result) {
                        if (result.status == "y") {
                            layer.msg("操作成功", { time: 1200 }, function () {
                            });
                        }
                        else {
                            layer.msg(result.info, { time: 2000 });
                            flag = true;
                        }
                    }
                });
            }
        }
    </script>
}
